package com.xjrsoft.module.customerTwo.barin.brain_merchant.service.impl;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xjrsoft.core.tool.utils.StringUtil;
import com.xjrsoft.module.customerTwo.barin.brain_merchant.entity.TBrainMerchant;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.xjrsoft.core.tool.utils.CollectionUtil;
import java.util.ArrayList;
import com.xjrsoft.module.customerTwo.barin.brain_merchant.dto.TBrainMerchantListDto;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.xjrsoft.common.page.ConventPage;
import com.xjrsoft.common.page.PageOutput;
import java.util.List;
import com.xjrsoft.module.customerTwo.barin.brain_merchant.mapper.TBrainMerchantMapper;
import com.xjrsoft.module.customerTwo.barin.brain_merchant.service.ITBrainMerchantService;
import com.xjrsoft.core.mp.base.BaseService;
import com.xjrsoft.core.tool.utils.Func;
import com.xjrsoft.module.customerTwo.barin.brain_merchant.vo.TBrainMerchantListVo;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;

/**
 *  服务实现类
 *
 * @author dongxinhang
 * @since 2024-04-29
 */
@Service
@AllArgsConstructor
public class TBrainMerchantServiceImpl extends BaseService<TBrainMerchantMapper, TBrainMerchant> implements ITBrainMerchantService {

	@Override
	public String addTBrainMerchant(TBrainMerchant tBrainMerchant) {
		String tBrainMerchantId = IdWorker.get32UUID();
		tBrainMerchant.setFMerchantid(tBrainMerchantId);
		boolean isSuccess = this.save(tBrainMerchant);
		return isSuccess ? tBrainMerchantId : null;
	}

	@Override
	public boolean updateTBrainMerchant(String id, TBrainMerchant tBrainMerchant) {
		tBrainMerchant.setFMerchantid(id);
		return this.updateById(tBrainMerchant);
	}

	public boolean delete(String ids) {
		List<String> idList = Func.toStrList(ids);
		if (this.removeByIds(idList)) {
			return true;
		}
		return false;
	}

	@Override
	public IPage<TBrainMerchantListVo> queryPage(Page page, TBrainMerchantListDto dto) {
		return this.getBaseMapper().queryPage(page,dto);
	}

}